#include "Spherical.h"
#include "Cartesian3.h"

namespace OCPP
{
	namespace Cesium
	{
	Spherical Spherical::fromCartesian3(Cartesian3 cartesian3) {
		double x = cartesian3.x;
		double y = cartesian3.y;
		double z = cartesian3.z;
		double radialSquared = x * x + y * y;

		Spherical result;

		result.clock = atan2(y, x);
		result.cone = atan2(sqrt(radialSquared), z);
		result.magnitude = sqrt(radialSquared + z * z);
		return result;
	}
	}
}


